﻿using System.ComponentModel.Composition;

namespace CardPlay.Client.ViewModels
{
    [Export(typeof(NewGameViewModel)), PartCreationPolicy(CreationPolicy.NonShared)]
    public sealed class NewGameViewModel : OptionDialog
    {
        public NewGameViewModel()
        {
            DisplayName = Resources.Caption_NewGame;
            Prompt = Resources.Prompt_NewGame;

            Options.AddRange(new[]
            {
                new CommandViewModel
                {
                    Instruction = Resources.Instruction_Quit,
                    Description = Resources.Description_CountsAsLoss,
                    Action = new RelayCommand<object>(delegate { FireComplete(true); })
                },
                new CommandViewModel
                {
                    Instruction = Resources.Instruction_Restart,
                    Description = Resources.Description_CountsAsLoss,
                    Action = new RelayCommand<object>(delegate { RestartRequested = true; FireComplete(true); })
                },
                new CommandViewModel
                {
                    Instruction = Resources.Instruction_KeepPlaying,
                    Action = new RelayCommand<object>(delegate { FireComplete(false); })
                }
            });
        }

        public bool RestartRequested { get; set; }
    }
}